package com.my.cd.singleton;

/**
 * 同步块双重检查判断实现单例
 */
public class SingletonB {
    private static volatile SingletonB instance;
    private SingletonB() {
    }

    public SingletonB getInstance() {
        if (instance == null) {
            synchronized (SingletonB.class) {
                if (instance == null) {
                    instance = new SingletonB();
                }
            }
        }
        return instance;
    }

}
